/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.login.view;

import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.qihoo.gamecenter.sdk.login.plugin.d.a;
import com.qihoo.gamecenter.sdk.login.plugin.f.a;
import com.qihoo.gamecenter.sdk.login.plugin.h.c;
import java.util.Map;

public class AutoLoginProgress extends RelativeLayout implements d {
    private String a;
    private Intent b;
    private f c;
    private a d;
    private LinearLayout e;
    private TextView f;
    private ImageView g;
    private float h;

    public AutoLoginProgress(Context paramContext, Intent paramIntent, String paramString, f paramf) {
        super(paramContext);
        this.a = paramString;
        this.b = paramIntent;
        this.c = paramf;
        this.d = a.a(paramContext);
        RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-1, -1);
        localLayoutParams.addRule(14);
        setLayoutParams(localLayoutParams);
        if (com.qihoo.gamecenter.sdk.login.plugin.h.f.d(paramContext))
            this.h = c.h;
        else
            this.h = c.j;
        a(paramContext);
        boolean bool = this.b.getBooleanExtra("show_autologin_switch", true);
        if (!(bool))
            return;
        d(paramContext);
    }

    public void a(Map paramMap) {
        Object localObject = null;
        if (paramMap != null) {
            String str1 = (String) paramMap.get("login_progress_msg");
            if (!(TextUtils.isEmpty(str1))) {
                localObject = str1;
            }
            else {
                String str2 = (String) paramMap.get("login_progress_username");
                if (!(TextUtils.isEmpty(str2))) {
                    int i = str2.length();
                    if (i > 15)
                        str2 = str2.substring(0, 15) + "...";
                }
                localObject = "<font color='#666666'>" + com.qihoo.gamecenter.sdk.login.plugin.d.a(d.a.aJ)
                        + "</font>&nbsp;<font color='#ff7f16'>" + str2 + "</font>";
            }
        }
        this.f.setText(Html.fromHtml((String) localObject));
        setVisibility(0);
        a(this.g);
    }

    public void a() {
        setVisibility(8);
        this.g.clearAnimation();
    }

    private void a(Context paramContext) {
        RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(
                com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 300.0F), -2);
        localLayoutParams.addRule(10);
        localLayoutParams.addRule(14);
        localLayoutParams.topMargin = com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 70.0F);
        this.e = new LinearLayout(paramContext);
        this.e.setLayoutParams(localLayoutParams);
        this.e.setGravity(1);
        this.e.setOrientation(1);
        this.d.a(this.e, -1073741812);
        addView(this.e);
        b(paramContext);
        c(paramContext);
    }

    private void b(Context paramContext) {
        LinearLayout localLinearLayout = new LinearLayout(paramContext);
        LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-2, -2);
        localLayoutParams.topMargin = com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 13.0F);
        localLayoutParams.bottomMargin = com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 13.0F);
        localLinearLayout.setLayoutParams(localLayoutParams);
        localLinearLayout.setGravity(17);
        this.f = new TextView(paramContext);
        this.f.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
        this.f.setGravity(16);
        this.f.setTextSize(1, this.h);
        this.f.setSingleLine();
        localLinearLayout.addView(this.f);
        this.e.addView(localLinearLayout);
    }

    private void c(Context paramContext) {
        LinearLayout localLinearLayout = new LinearLayout(paramContext);
        LinearLayout.LayoutParams localLayoutParams1 = new LinearLayout.LayoutParams(-2, -2);
        localLayoutParams1.bottomMargin = com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 13.0F);
        localLinearLayout.setLayoutParams(localLayoutParams1);
        localLinearLayout.setGravity(17);
        this.g = new ImageView(paramContext);
        LinearLayout.LayoutParams localLayoutParams2 = new LinearLayout.LayoutParams(
                com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 25.0F),
                com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 25.0F));
        localLayoutParams2.rightMargin = com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 8.0F);
        this.g.setLayoutParams(localLayoutParams2);
        localLinearLayout.addView(this.g);
        TextView localTextView = new TextView(paramContext);
        localTextView.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
        localTextView.setTextColor(-11776948);
        localTextView.setTextSize(1, this.h);
        localTextView.setText(com.qihoo.gamecenter.sdk.login.plugin.d.a(d.a.aH));
        localLinearLayout.addView(localTextView);
        this.e.addView(localLinearLayout);
    }

    private void d(Context paramContext) {
        RelativeLayout localRelativeLayout = new RelativeLayout(paramContext);
        RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-2, -2);
        localLayoutParams.addRule(10);
        localLayoutParams.addRule(11);
        localLayoutParams.alignWithParent = true;
        localLayoutParams.topMargin = com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 20.0F);
        localLayoutParams.rightMargin = com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 20.0F);
        this.d.a(localRelativeLayout, -1073741768);
        localRelativeLayout.setLayoutParams(localLayoutParams);
        localLayoutParams = new RelativeLayout.LayoutParams(-2, -2);
        TextView localTextView = new TextView(paramContext);
        localTextView.setLayoutParams(localLayoutParams);
        localTextView.setText(com.qihoo.gamecenter.sdk.login.plugin.d.a(d.a.aI));
        localTextView.setTextColor(-1);
        localTextView.setGravity(17);
        localTextView.setTextSize(1, c.i);
        localTextView.setPadding(com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 10.0F),
                com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 5.0F),
                com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 10.0F),
                com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 5.0F));
        localTextView.setCompoundDrawablePadding(com.qihoo.gamecenter.sdk.login.plugin.h.f.a(paramContext, 5.0F));
        this.d.a(localTextView, 1073741881, 0, 0, 0);
        localRelativeLayout.setOnClickListener(new View.OnClickListener() {
            public void onClick(View paramView) {
                AutoLoginProgress.a(AutoLoginProgress.this).a(2, null);
            }
        });
        localRelativeLayout.addView(localTextView);
        addView(localRelativeLayout);
    }

    private void a(ImageView paramImageView) {
        this.d.a(paramImageView, 1073741871);
        RotateAnimation localRotateAnimation = new RotateAnimation(0.0F, 360.0F, 1, 0.5F, 1, 0.5F);
        localRotateAnimation.setRepeatCount(-1);
        localRotateAnimation.setDuration(1000L);
        localRotateAnimation.setInterpolator(new LinearInterpolator());
        paramImageView.setAnimation(localRotateAnimation);
    }

    public void b() {
        setVisibility(0);
    }
}